package com.woniuxy.reader.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.woniuxy.reader.entity.BookData;
import com.woniuxy.reader.entity.Collection;
import com.woniuxy.reader.mapper.BookDataMapper;
import com.woniuxy.reader.service.BookDataService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zh_o
 * @since 2020-10-12
 */
@Service
public class BookDataServiceImpl extends ServiceImpl<BookDataMapper, BookData> implements BookDataService {
    @Resource
    private BookDataMapper bookDataMapper;
    @Override
    public BookData getByBookId(Integer bookId) {
        QueryWrapper<BookData> bookWrapper=new QueryWrapper<BookData>();
        bookWrapper.eq("book_id", bookId);
        return bookDataMapper.selectOne(bookWrapper);
    }

    /**
     　* @Author daxigua
     * @Description  传入实体bookdata 进行新增
     * @Date 2020/10/17  15:24
     * @Param  * @param null
     * @return 影响行数
     */
    @Override
    public Integer insertBookDataByBookData(BookData bookData) {
        int insert = bookDataMapper.insert(bookData);
        return insert;
    }
}
